<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:p="http://java.sun.com/jsf/portlet/components" version="2.0">
	<f:view>
		<p:portletPage>
			<a4j:outputPanel layout="block" styleClass="mediadoresWrapper">
				<a4j:outputPanel layout="block" styleClass="headerWrapper">
					<a4j:outputPanel layout="block" styleClass="accesible clearfix"></a4j:outputPanel>
				</a4j:outputPanel>
				<a4j:outputPanel layout="block" styleClass="topMenuWrapper">
					<h:form>
						<a4j:outputPanel>
							<a4j:commandLink value="Volver" action="back" immediate="true" styleClass="topMenuLink" />
						</a4j:outputPanel>
					</h:form>
				</a4j:outputPanel>
				<a4j:outputPanel layout="block" styleClass="contentWrapper">
					<h:form id="templateDetailForm">
						<a4j:outputPanel layout="block" styleClass="titleWrapper">
							<h:outputText value="Detalle de plantilla PDF" />
						</a4j:outputPanel>
						<a4j:outputPanel layout="block" styleClass="validatonMessagesWrapper">
							<rich:messages />
						</a4j:outputPanel>
						<a4j:outputPanel layout="block" rendered="#{ApplicationConfiguration.debugEnabled}">
							<rich:panel>
								<h:outputText value="#{PDFTemplateDetailManagement.currentTemplate}" />
							</rich:panel>
							<rich:spacer height="10" />
						</a4j:outputPanel>
						<rich:panel id="pdfTemplateDetailFormPanel">
							<dl class="formList">
								<dt>Nombre:</dt>
								<dd><h:inputText id="id_name_TF" value="#{PDFTemplateDetailManagement.currentTemplate.name}" styleClass="largeTextField" /></dd>
								<dt>Fecha de vigencia:</dt>
								<dd><rich:calendar timeZone="#{ApplicationConfiguration.serverTimeZone}" value="#{PDFTemplateDetailManagement.currentTemplate.date}" mode="client" popup="true" datePattern="dd-MM-yyyy" enableManualInput="false" showApplyButton="false" locale="es_ES" /></dd>
								<dt>Tipo de plantilla:</dt>
								<dd><h:selectOneMenu id="id_className_LB" value="#{PDFTemplateDetailManagement.currentTemplate.className}">
									<f:selectItem itemLabel="Simulación" itemValue="com.tenentia.pcmps.swm.util.pdf.generators.InsurancePolicySimulation" />
									<f:selectItem itemLabel="Solicitud" itemValue="com.tenentia.pcmps.swm.util.pdf.generators.InsurancePolicyRequest" />
								</h:selectOneMenu></dd>
								<dt>Fichero de la clase Java generadora:</dt>
								<dd><a4j:outputPanel layout="block">
									<rich:fileUpload addControlLabel="Seleccionar fichero" allowFlash="false" autoclear="true" fileUploadListener="#{PDFTemplateDetailManagement.fileUploadListener}" id="id_pdfTemplateFileUpload" immediate="true" immediateUpload="false" listHeight="60" listWidth="auto" maxFilesQuantity="1" onuploadcomplete="onUploadCompleteJSHandler();" uploadControlLabel="Procesar fichero" uploadData="#{PDFTemplateDetailManagement.uploadedFiles}" rendered="#{!PDFTemplateDetailManagement.showUploadedFileTextField}" />
									<h:inputText id="id_fileName_TF" value="#{PDFTemplateDetailManagement.uploadedFileName}" styleClass="largeTextField" readonly="true" rendered="#{PDFTemplateDetailManagement.showUploadedFileTextField}" />
								</a4j:outputPanel></dd>
							</dl>
							<a4j:jsFunction name="onUploadCompleteJSHandler" actionListener="#{PDFTemplateDetailManagement.onUploadCompleteHandler}" reRender="pdfTemplateDetailFormPanel" />
							<a4j:outputPanel layout="block" styleClass="richPanelButtons">
								<a4j:commandButton action="#{PDFTemplateDetailManagement.save}" value="Guardar" styleClass="richButton" />
								<a4j:commandButton action="#{PDFTemplateDetailManagement.delete}" value="Eliminar" styleClass="richButton" rendered="#{!empty PDFTemplateDetailManagement.currentTemplate.internalID}" />
								<a4j:commandButton actionListener="#{PDFTemplateDetailManagement.test}" value="Descargar" styleClass="richButton" rendered="#{!empty PDFTemplateDetailManagement.currentTemplate.internalID}" />
							</a4j:outputPanel>
							<a4j:outputPanel layout="block" styleClass="accesible clearfix"></a4j:outputPanel>
						</rich:panel>
					</h:form>
				</a4j:outputPanel>
				<a4j:outputPanel layout="block" styleClass="footerWrapper">
					<a4j:outputPanel layout="block" styleClass="accesible clearfix"></a4j:outputPanel>
				</a4j:outputPanel>
			</a4j:outputPanel>
		</p:portletPage>
	</f:view>
</jsp:root>